<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
			<style type="text/css">
		body{height: 100000px;
		}
		
		#d1{
			border: 1px black solid;
			padding-left:100px ;
			position: absolute;
			width: 500px;
			
		}		
	</style>
	
	<script src="../js/jQuery-1.8.3 (1).js" type="text/javascript"></script>
	<script type="text/javascript">

		$(function(){
		var a=$("#d1").offset().top;
			
			$(window).scroll(function(){
			var shijilen=$(this).scrollTop();
				if(shijilen>=a){
					$("#d1").css({"position":"fixed","top":0});
				}else{
					$("#d1").css("position","static"); 
				}
				
			});
			
			
		});
	</script>
	</head>
	<body>
		
		<div id="d1">
			<input type="text" />
		</div>
	</body>
</html>
